package apptoko.com.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;

public class AspectRatioImageView extends ImageView {
	public AspectRatioImageView(Context paramContext) {
		super(paramContext);
	}

	public AspectRatioImageView(Context paramContext, AttributeSet paramAttributeSet) {
		super(paramContext, paramAttributeSet);
	}

	public AspectRatioImageView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
		super(paramContext, paramAttributeSet, paramInt);
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		// TODO Auto-generated method stub
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		int i = View.MeasureSpec.getSize(heightMeasureSpec);
		setMeasuredDimension(i, i * getDrawable().getIntrinsicHeight() / getDrawable().getIntrinsicWidth());
	}
}
